package server.java.autoduel.Locations;

import java.io.Serializable;
import java.nio.ByteBuffer;
import java.util.ArrayList;

import server.java.autoduel.Network.OPCODES;

import com.sun.sgs.app.AppContext;
import com.sun.sgs.app.ManagedObject;
import com.sun.sgs.app.ManagedReference;

/**
 * Represents Autoduel's Arena, where many different events take place
 * 
 * @author Ian Axelrod
 * @author Liz Ha
 * @author Andrew Muldowney
 * @author Edward Futch
 */
public class Arena extends Location implements Serializable, ManagedObject {
	private static final long serialVersionUID = 834200937760528064L;

	/**
	 * The schedule for events being held in the arena
	 */
	private ArrayList<ManagedReference<Event>> schedule;

	/* arenaMap : Grid */

	@Override
	public ByteBuffer encodePacket(OPCODES opcode) {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * @return the schedule
	 */
	public ArrayList<ManagedReference<Event>> getSchedule() {
		return this.schedule;
	}

	@Override
	public void loadMembers() {
		// TODO Load schedule content
	}

	/**
	 * @param schedule
	 *            the schedule to set
	 */
	public void setSchedule(ArrayList<ManagedReference<Event>> schedule) {
		AppContext.getDataManager().markForUpdate(this);
		this.schedule = schedule;
	}
}